package com.groot.medical.service;

import com.groot.medical.dao.MedicalDao;
import com.groot.medical.dao.MedicalDaoImpl;
import com.groot.medical.entity.MedicalInstitution;
import com.groot.medical.entity.PageBean;

public class MedicalServiceImpl implements MedicalService {
	private MedicalDao medicalDao = new MedicalDaoImpl();
	@Override
	public PageBean findByPage(int pageNum, int pageSize) {
		//获取记录总条数
		int totalRecord = medicalDao.getAllMenuCount();
		@SuppressWarnings("rawtypes")
		PageBean pegeBean = new PageBean<>(pageNum, pageSize, totalRecord);
		int startIndex = pegeBean.getStartIndex();
		pegeBean.setList(medicalDao.findMenuByPage(startIndex,pageSize));
		return pegeBean;
	}
	@Override
	public int addMedical(MedicalInstitution medical) {
		// TODO Auto-generated method stub
		return medicalDao.addMedical(medical);
	}
	@Override
	public MedicalInstitution findMedicalInfoById(String id) {
		// TODO Auto-generated method stub
		return medicalDao.findMedicalInfoById(id);
	}
	@Override
	public int editMedical(MedicalInstitution medical) {
		// TODO Auto-generated method stub
		return medicalDao.editMedical(medical);
	}
	@Override
	public int CheckNameExist(String medicalname) {
		// TODO Auto-generated method stub
		return medicalDao.CheckNameExist(medicalname);
	}

}
